#ifndef LINEAR_LINKED_LIST_H
#define LINEAR_LINKED_LIST_H

#define MAX_TITLE_LENGTH        128
#define MAX_TIMESTAMP_LENGTH    30
#define MAX_URL_LENGTH          128

typedef struct {
    char title[MAX_TITLE_LENGTH];
    char timestamp[MAX_TIMESTAMP_LENGTH];
    char url[MAX_URL_LENGTH];
} BrowserData_t;

typedef struct ListNode{
    BrowserData_t browserData;
    struct ListNode *next;
} LinkedNode_t;

typedef enum {
    LINKED_LIST_SUCCESS,
    LINKED_LIST_FAIL,
}LinkedStatus_t;

LinkedNode_t* LinkedListInit();
LinkedStatus_t LinkedListInsertToHead(LinkedNode_t *head, BrowserData_t *data);
LinkedStatus_t LinkedListInsertToTail(LinkedNode_t *head, BrowserData_t *data);
LinkedStatus_t LinkedListInsertCom(LinkedNode_t *head, int index, BrowserData_t *data);
LinkedNode_t *LinkedListSearchByIndex(LinkedNode_t *head, int index);
LinkedNode_t *LinkedListSearchByData(LinkedNode_t *head, BrowserData_t *data);
LinkedStatus_t LinkedListDeleteByIndex(LinkedNode_t *head, int index);
LinkedStatus_t LinkedListDeleteByData(LinkedNode_t *head, BrowserData_t *data);
void LinkedListDestroy(LinkedNode_t *head);

#endif
